{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">分公司管理</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                data-auth-add="{:$auth->check('auth.manager2/add')}"
                data-auth-edit="{:$auth->check('auth.manager2/edit')}"
                data-auth-delete="{:$auth->check('auth.manager2/del')}"></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
layui.use('yznTable', function() {
    var table = layui.yznTable;
    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        add_url: '{:url("add")}',
        edit_url: '{:url("edit")}',
        delete_url: '{:url("del")}',
    };
    table.render({
        init: init,
        toolbar: ['refresh','add'],
        url: '{:url("index")}',
        cols: [
            [
                { field: 'id', width: 80, title: 'ID'},
                { field: 'username', width: 150, title: '登录名', searchOp: 'like' },
                { field: 'nickname', title: '公司名称', searchOp: 'like'  },
                { field: 'area_name', width: 120, title: '公司区域', search:false},
                { field: 'mobile',width: 200, title: '联系电话', searchOp: 'like'  },
                { field: 'email',width: 200, title: '联系邮箱', searchOp: 'like'  },
                { field: 'last_login_ip', title: '最后登录IP', searchOp: 'like'  },
                { field: 'last_login_time', width: 200, title: '最后登录时间', search: 'range' },
                { width:100, title: '操作',templet: function (d){
                    if(d.id=={$userInfo.id}){
                        return '<a class="layui-btn layui-btn-xs layui-btn-danger layui-btn-disabled">不可操作</a>';
                    }else{
                        return yznTable.formatter.tool.call(this,d,this);
                    }
                },operat: ['edit','delete']}
            ]
        ],
        page: {}
    });
    yznTable.bindevent();
});
</script>
{/block}